package com.moi.topslidinglogindemo;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import static com.moi.topslidinglogindemo.R.id.tv_back;

/**
 * Created by moi on 2015/3/15.
 * 一个接受跳转的Activity
 */
public class SecondActivity extends Activity{

    private TextView userName;
    private TextView back;

    //跳转传递的信息
    public static void actionStart(Context context, String data) {
        Intent intent = new Intent(context, SecondActivity.class);
        intent.putExtra("user_name", data);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_layout);
        userName = (TextView) findViewById(R.id.tv_name);
        userName.setText(getIntent().getStringExtra("user_name"));
        back = (TextView) findViewById(tv_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
